<?php

/**
 * WeEngine System
 *
 * (c) We7Team 2021 <https://www.w7.cc>
 *
 * This is not a free software
 * Using it under the license terms
 * visited https://www.w7.cc for more details
 */

class DemoLaravelWechatServiceProvider extends \ProviderAbstract
{
    public function register()
    {
        //适配laravel框架
        $_SERVER['DOCUMENT_ROOT']   = MODULE_ROOT . DIRECTORY_SEPARATOR . 'public';
        $_SERVER['DOCUMENT_URI']    = '/index.php';
        $_SERVER['REQUEST_URI']     = AppData::getUri();
        $_SERVER['SCRIPT_NAME']     = '/index.php';
        $_SERVER['PHP_SELF']        = '/index.php';
        $_SERVER['PATH_TRANSLATED'] = MODULE_ROOT . DIRECTORY_SEPARATOR . 'public';
        $_SERVER['SCRIPT_FILENAME'] = MODULE_ROOT . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'index.php';
        //这里放一些全局的变量可在应用内使用
        $GLOBALS['module_name'] = $this->moduleName;
    }

    public function boot()
    {
        require MODULE_ROOT . '/public/index.php';
    }
}
